/*!
 * Header file corresponding to the albums list. (albums.cpp)
 * THIS FILE IS NOT USED FOR THE MOMENT
 * @author Mazzer Yannis, Calingarayar Martial
 */
#ifndef _ALBUMS_H
#define _ALBUMS_H

#include <QList>
#include <QSqlDatabase>
#include <QSqlTableModel>
#include "../liteconnector/liteconnector.h"
#include "album/album.h"

/*!
 * Declaration of the AlbumList structure as a QList of a pointer to Album.
 */
typedef QList<Album *> AlbumList;


/*!
 * This class gather all informations about the albums list.
 */
class Albums : public QSqlTableModel
{
    Q_OBJECT
    public:
/*!
 * Albums class construcor.
 * @param &db
 * @param parent A pointer to the parent which calle the constructor.
 */
	Albums(QSqlDatabase &db, QWidget *parent = 0);

/*!
 *Albums class destructor.
 */
	~Albums();

/*!
 * This function returns the information about the album.
 * @param &albumNumber The number of the album wanted.
 * @return The information about the album.
 */
	Album *getAlbum(const int &albumNumber);

/*!
 * This function returns the information about the album.
 * @param &albumIndex The index of the album wanted.
 * @return The information about the album.
 */
	Album *getAlbum(const QModelIndex &albumIndex);

/*!
 * This function returns the list of albums.
 * @return List of albums.
 */
	AlbumList getAlbumList();

/*!
 * This function adds a new album to the list.
 * @param newAlbum The name of the new album.
 * @param ok is set to false if the album is already in the list.
 * @return Index of album if it isn't new otherwise 0.
 */
	int addAlbum(Album *newAlbum, bool ok = true);

/*!
 *This function remove an album to the list.
 * @param oldAlbum The old album you wish remove to the list.
 */
	void removeAlbum(Album *oldAlbum);

    public slots:

/*!
 * This function update the list of albums.
 */
	void updateAlbumList();


    private:
	AlbumList albums;

};

#endif // _ALBUMS_H
